const Router = require('koa-router')
const { Book } = require('@models/book')


const router = new Router({
    prefix: '/v1/book'
})

router.get('/latest', async (ctx, next) => {
    const books = await Book.findOne({
        order: [
            ['id', 'DESC']
        ]
    })

    // let art = await Art.getData(flow.art_id, flow.type);
    // const likeLatest = await Favor.userLikeIt(flow.art_id, flow.type, ctx.auth.uid);

    // art.setDataValue('index', flow.index);
    // art.setDataValue('like_status', likeLatest);

    ctx.body = {
        books
    }
})

module.exports = router
